Skip to content

feat(examples): add Material UI chat example (#392)#587

Open
Shinyaigeek wants to merge 1 commit into
thesysdev:mainfrom
Shinyaigeek:example/material-ui-chat
Open

feat(examples): add Material UI chat example (#392)#587
Shinyaigeek wants to merge 1 commit into
thesysdev:mainfrom
Shinyaigeek:example/material-ui-chat

Conversation

@Shinyaigeek
Copy link
Copy Markdown
Contributor

Closes #392.

Adds examples/material-ui-chat — a generative-UI chat app that maps OpenUI Lang onto a Material UI component library, as the MUI counterpart to examples/shadcn-chat. It shows how to integrate OpenUI with an existing design system (MUI components + theme), including light/dark mode.

What's included

  • Component library (src/lib/mui-genui/) wrapping MUI primitives, covering a representative subset: CardHeader, TextContent, Heading, Alert, List, Separator, Progress, Table, BarChart/LineChart/PieChart (via @mui/x-charts), Form/FormControl/Input/Select/SwitchGroup, Button/Buttons, Tabs, Accordion, FollowUpBlock (~22 components).
  • OpenAI streaming chat route (src/app/api/chat/route.ts) using runTools + SSE, mirroring shadcn-chat.
  • MUI theming via ThemeProvider + CssBaseline with a system-preference + manual light/dark toggle.
  • Prompt generation through the OpenUI CLI (openui generate src/library.ts).

Verification

  • pnpm install
  • pnpm generate:prompt ✅ (writes src/generated/system-prompt.txt)
  • tsc --noEmit
  • next build

🤖 Generated with Claude Code

Add `examples/material-ui-chat`, a generative-UI chat app that maps OpenUI
Lang onto a Material UI component library — cards, tables, forms, tabs,
accordion, alert, list, and charts (via `@mui/x-charts`) — with MUI
`ThemeProvider`/`CssBaseline` theming, a system + manual light/dark toggle,
and an OpenAI streaming chat route. Mirrors the structure of the
`shadcn-chat` example; the system prompt is generated from the library via
the OpenUI CLI (`openui generate src/library.ts`).

Closes thesysdev#392.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vishxrad
Copy link
Copy Markdown
Contributor

vishxrad commented Jun 1, 2026

@Shinyaigeek thanks a lot for your contribution! I will review this soon.

name: "Heading",
props: HeadingSchema,
description: 'Section heading. level: "h1" | "h2" | "h3" | "h4".',
component: ({ props }) => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

During streaming, props.level can temporarily contain a partial value such as "h" before completing to "h2". Since it is passed directly to Typography’s component prop, React attempts to render an invalid <h> element and logs a console error. Could we validate the value against h1h4 and fall back to h2 for partial or invalid values?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default MUI chart tooltip is portaled to the document body and becomes detached from the chart when the chat container scrolls, leaving it fixed near the top of the viewport. Could we configure the tooltip Popper here so it remains anchored correctly within the scrolling chat surface, or closes when the chart scrolls out of view?

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Material UI example app

2 participants